# -*- coding: utf-8 -*-            
# @Author : chenliang
# @Time : 2024/1/5 13:27
from lib2to3.pgen2 import driver

from selenium.webdriver.common.by import By
from selenium.webdriver import ActionChains
from datetime import datetime



class ProductMangodbReplicaLocator:



   """
   my resource 页面
   """
   # my resource tab页面菜单列表
   my_resource_tab_list = (By.CSS_SELECTOR,'[class="antd4-tabs-tab-btn"]')
   # product 列表
   my_resource_product_list = (By.CSS_SELECTOR,'[class="productBtn___2kdzl"]')
   # create_new按钮
   move_storge_create_new = (By.XPATH,'(//button[@class="antd4-btn antd4-btn-primary"])[3]')
   # search按钮
   click_search_mango = (By.XPATH, '(//button[@class="antd4-btn antd4-btn-primary"])[4]')
   #实例检查页面
   iframe_instance_status = (By.CSS_SELECTOR,'[id="hj_container"]')

   ###################### Block Storge #############################################
   """
    mangodb replica页面
   """

   # 判断进入mangodb replica页面
   #if_enter_mangodb_replica_page = (By.XPATH, '(//div[@class="product-title___YYoNb"])[1]')
   if_enter_mangodb_replica_page = (By.CSS_SELECTOR, '#root > section > main > div.cre-shell-layout-content > div.productLayout___5vCZf > div > div > div > div > div > div > div.cre-page-container-default-content > div.cre-page-container-header > div > div > span > div > div > div:nth-child(1) > div')
   # 判断进入postgresql页面
   if_enter_postgresql_page = (By.CSS_SELECTOR, '#root > section > main > div.cre-shell-layout-content > div.productLayout___5vCZf > div > div > div > div > div > div > div.cre-page-container-default-content > div.cre-page-container-header > div > div > span > div > div > div:nth-child(1) > div')
   # 判断进入sqlserver页面
   if_enter_sqlserver_page = (By.CSS_SELECTOR, '#root > section > main > div.cre-shell-layout-content > div.productLayout___5vCZf > div > div > div > div > div > div > div.cre-page-container-default-content > div.cre-page-container-header > div > div > span > div > div > div:nth-child(1) > div')
   # 判断是否进入mysql页面
   if_enter_mysql_page = (By.XPATH,'(//span[@class="cre-page-container-header-panel-title cre-page-container-header-panel-title-default"])')
   #是否有Payment Successful
   if_payment_succ = (By.XPATH, '//*[@id="root"]/section/main/div[2]/div[1]/div/div/div/div/div/div/div/div[3]/div')

   #点击菜单...
   click_menu = (By.CSS_SELECTOR, '#rc-tabs-0-panel-271 > div > div > div > div > div > div > div > table > tbody > tr:nth-child(2) > td.antd4-table-cell.antd4-table-cell-fix-right.antd4-table-cell-fix-right-first > div > div.antd4-dropdown-trigger.table-operation-omit > span > svg > path')
   #点击modify
   click_modify = (By.XPATH,'(//span[@class="antd4-dropdown-menu-title-content"])[1]')
   #点击release
   #click_release = (By.CSS_SELECTOR, 'body > div:nth-child(9) > div > div > ul > li:nth-child(2) > span')
   click_release = (By.XPATH,'(//span[@class="antd4-dropdown-menu-title-content"])[2]')
   #再次点击release
   click_release_again = (By.XPATH, '//*[@id="root"]/section/main/div[2]/div[1]/div/div/div/div/div[2]/div[2]/button/span')
   #点击yes relaese
   click_yes_release = (By.XPATH, '/html/body/div[3]/div/div[2]/div/div[2]/div/div/div[2]/button[2]/span')
   #是否包含release success
   if_release_success = (By.XPATH, '//*[@id="root"]/section/main/div[2]/div[1]/div/div/div[3]/div')
   #点击增加存储大小
   click_add_storage = (By.CSS_SELECTOR, '#creForm > div:nth-child(2) > div.antd4-row.antd4-form-item.antd4-form-item-with-help.capacity___1pqaQ.antd4-form-item-has-success > div.antd4-col.antd4-col-19.antd4-form-item-control > div.antd4-form-item-control-input > div > div > div > div.pedometer___5YOh9 > div > div > div:nth-child(3) > span > svg')
   #点击terms of service
   #click_terms_of_service_add = (By.XPATH, '//*[@id="root"]/section/main/div[2]/div[1]/div/div/div/div/div[1]/div[2]/div[2]/div/div[2]/div/div[2]/label/span/input')


   #点击ecs选择框
   click_ecs_selector = (By.XPATH, '//*[@id="rc_select_3"]')
   #点击ecs实例
   select_ecs = (By.XPATH, '//*[@id="creForm"]/div[2]/div[2]/div[2]/div[2]/div/div/div/div[1]/div/div[2]/div/div/div/div[2]/div/div/div/div/div')
   #点击续订renew
   click_renew = (By.XPATH, '//*[@id="rc-tabs-0-panel-271"]/div/div/div/div/div/div/div/table/tbody/tr[2]/td[15]/div/div[1]/div/button/span')
   #续订时点击terms of services
   click_renew_terms_of_services = (By.XPATH, '//*[@id="root"]/section/main/div[2]/div[1]/div/div/div/div/div[1]/div[2]/div/div[1]/div[3]/div/div[2]/div/div[2]/label/span/input')


   #点击实例id
   click_instance_id = (By.XPATH, '//*[@id="rc-tabs-0-panel-271"]/div/div/div/div/div/div/div/table/tbody/tr[2]/td[1]/div/a')
   #检查status run状态
   click_status_run = (By.XPATH,'//*[@id="app"]/div/div[2]/div/div[1]/div[1]/div[2]/div[1]/div[2]/div/div/div[2]/table/tbody/tr/td[4]/div/span/span[2]')
   #检查status creating状态
   click_status_creating = (By.XPATH, '//*[@id="app"]/div/div[2]/div/div[1]/div[1]/div[2]/div[1]/div[2]/div/div/div[2]/table/tbody/tr/td[4]/div/span/span')
   #点击search
   click_search = (By.XPATH, '//*[@id="app"]/div/div[2]/div/div[1]/div[1]/div[2]/div[1]/div[1]/div[2]/div/div/button')
   #点击sharded的search
   click_sharded_search = (By.XPATH, '//*[@id="app"]/div/div[2]/div/div[1]/div[1]/div[2]/div[1]/div[1]/div[2]/div/button')
   #回到用户中心
   #click_user_center = (By.XPATH, '//*[@id="root"]/section/main/div[1]/div/div[2]/div[1]/div[2]/div[1]/div')
   click_user_center = (By.XPATH, '(//div[@class="console-btn"])[1]')
   #点击search


   # 判断进入mangodb sharded页面
   #if_enter_mangodb_sharded_page = (By.XPATH, '(//div[@class="product-title___YYoNb"])[1]')
   if_enter_mangodb_sharded_page = (By.CSS_SELECTOR, '#root > section > main > div.cre-shell-layout-content > div.productLayout___5vCZf > div > div > div > div > div > div > div.cre-page-container-default-content > div.cre-page-container-header > div > div > span > div > div > div:nth-child(1) > div')
   #点击terms of service
   click_terms_of_service = (By.XPATH, '//*[@id="root"]/section/main/div[2]/div[1]/div/div/div/div/div[1]/div[2]/div/div[1]/div[3]/div/div[2]/div/div[2]/label/span/input')
   #click_terms_of_service = (By.XPATH, '(//input[@class="antd4-checkbox-input"])[1]')
   #点击buy now
   click_buy_now = (By.XPATH, '//*[@id="root"]/section/main/div[2]/div[1]/div/div/div/div/div/div/div[2]/div[2]/button/span')
   #点击renew buy now
   click_renew_buy_now =(By.XPATH, '//*[@id="root"]/section/main/div[2]/div[1]/div/div/div/div/div[2]/div[2]/button/span')
   #点击pay
   click_pay = (By.XPATH, '//*[@id="root"]/section/main/div[2]/div[1]/div/div/div/div/div[2]/div[2]/button/span')
   #选择分片集实例
   select_sharded =(By.XPATH, '//*[@id="app"]/div/div[1]/div/div/div/div[1]/div[2]/ul/li[2]/a/span')

   #分片集变配页面
   if_sharded_modify_page = (By.XPATH, '//*[@id="app"]/div/div[1]/div/div[1]/div/div[1]/div[2]/ul/li[1]/a/span')

   #postgresql sub的instancename输入框
   input_sub_instancename = (By.XPATH, '//*[@id="creForm_instanceName"]')
   #postgresql sub的whitelist输入框
   input_sub_whitelist = (By.XPATH, '//*[@id="creForm_whiteList"]')
   #postgresql sub的buy now按钮
   click_postgresql_sub_buy_now = (By.XPATH, '//*[@id="root"]/section/main/div[2]/div[1]/div/div/div/div/div/div/div[2]/div[2]/button/span')
